﻿<!--note: most of the time, dialog is just the same as window
    but it would be better for you to specify the "ResizeMode"
    and "WindowStartupLocation" for dialog-->
<Window x:Class="Dialogs.PersonEditDlg"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Edit Person Information" Height="152" Width="393"
        ResizeMode="NoResize"
        WindowStartupLocation="CenterOwner"
        ShowInTaskbar="False">
    <!--it is common practice to set the 'WindowStartupLocation=CenterOwner' for dialogs-->
    <Window.Resources>
        <Style  TargetType="Label">
            <Setter Property="Margin" Value="5"/>
            <Setter Property="VerticalContentAlignment" Value="Center"/>
            <Setter Property="HorizontalContentAlignment" Value="Right"/>
        </Style>
        <Style  TargetType="TextBox">
            <Setter Property="Margin" Value="5"/>
            <Setter Property="VerticalContentAlignment" Value="Center"/>
            <Setter Property="HorizontalContentAlignment" Value="Center"/>
        </Style>
        <Style  TargetType="Button">
            <Setter Property="Margin" Value="5"/>
        </Style>
    </Window.Resources>
    <Grid Name="grid">
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="*" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        <Label Grid.Row="0" Grid.Column="0" Content="Name:"   />
        <TextBox Grid.Column="1" Grid.ColumnSpan="3"  Name="tbxName"  Text="{Binding Name}"/>
        <Label Grid.Row="1" Grid.Column="0" Content="Age:"   />
        <TextBox Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="3"  Name="tbxAge"  Text="{Binding Age}"  />
        <Button Content="OK" Grid.Column="2" Grid.Row="2" Name="btnOK" IsDefault="True" Click="btnOK_Click" />
        <Button Content="Cancel" Grid.Column="3" Grid.Row="2" Name="btnCancel"  IsCancel="True"/>
    </Grid>
</Window>
